# 父类与子类
# 类的继承
# 构造函数调用
# 多态


# 父类
class SchoolMember:
    """学校成员基类"""

    def __init__(self, name, age):
        self.name = name
        self.age = age
        print("initializing sm {}".format(self.name))

    def tell(self):
        """描述信息"""
        print("name: {}, age: {}".format(self.name, self.age), end=" ")


# 子类
class Teacher(SchoolMember):

    def __init__(self, name, age, salary):
        # 类名调用父类的构造函数
        SchoolMember.__init__(self, name, age)
        self.salary = salary
        print("initializing teacher {}".format(self.name))

    def tell(self):
        SchoolMember.tell(self)
        print("salary: {}".format(self.salary))


class Student(SchoolMember):

    def __init__(self, name, age, marks):
        SchoolMember.__init__(self, name, age)
        self.marks = marks
        print("initializing teacher {}".format(self.name))

    def tell(self):
        # 类名调用父类的方法
        SchoolMember.tell(self)
        print("marks: {}".format(self.marks))


t = Teacher("Mrs xxxx", 22, 20000)
s = Student("t xxx", 10, 90)

print()

members = [t, s]
for m in members:
    m.tell()

